<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box1 {
            position: relative;
            width: 600px;
            height: 400px;
            background-color: pink;
            border: 10px solid gold;
        }
        #box2 {
            height: 300px;
            margin-left: 100px;
            background-color: yellowgreen;
        }
        #box3 {
            position: absolute;
            top: 200px;
            left: 200px;
            width: 100px;
            height: 100px;
            background-color: green;
        }
        #box4 {
            height: 100px;
            background-color: skyblue;
        }
    </style>
</head>
<body>
    <div id="box1">box1
        <div id="box2">box2
            <div id ="box4">hello</div>
            <div id="box3">box3</div>
        </div>
    </div>
    <script>
        var box3 =  document.getElementById("box3");
        console.log(box3.offsetLeft, box3.offsetTop);
        
    </script>
</body>
</html>